<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Time - time: Ruby Standard Library Documentation</title>


<script src="./js/navigation.js" defer></script>
<script src="./js/search.js" defer></script>
<script src="./js/search_index.js" defer></script>
<script src="./js/searcher.js" defer></script>
<script src="./js/darkfish.js" defer></script>

<script src="./js/jquery-3.2.0.min.js"></script>

<script src="./js/vue.min.js"></script>
<script src="./js/js.cookie.min.js"></script>

<link href="./css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="./css/rdoc.css" rel="stylesheet">
<link href="./css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
  var index_rel_prefix = "./";
  var darkModeCsseHref = "./css/rdoc-dm.css"
  var defaultModeCssHref = "./css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="./index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="./table_of_contents.html#pages">Pages</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-httpdate">::httpdate</a>
    <li ><a href="#method-c-iso8601">::iso8601</a>
    <li ><a href="#method-c-parse">::parse</a>
    <li ><a href="#method-c-rfc2822">::rfc2822</a>
    <li ><a href="#method-c-rfc822">::rfc822</a>
    <li ><a href="#method-c-strptime">::strptime</a>
    <li ><a href="#method-c-xmlschema">::xmlschema</a>
    <li ><a href="#method-c-zone_offset">::zone_offset</a>
    <li ><a href="#method-i-httpdate">#httpdate</a>
    <li ><a href="#method-i-iso8601">#iso8601</a>
    <li ><a href="#method-i-rfc2822">#rfc2822</a>
    <li ><a href="#method-i-rfc822">#rfc822</a>
    <li ><a href="#method-i-xmlschema">#xmlschema</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Time">
    <h1 id="class-Time" class="class">
      class Time
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="VERSION">VERSION
          <dd>
        </dl>
        </section>



                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-httpdate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">httpdate</span><span
                                class="method-args">(date)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Parses <code>date</code> as an HTTP-date defined by RFC 2616 and converts it to a <a href="Time.html"><code>Time</code></a> object.</p>

<p>ArgumentError is raised if <code>date</code> is not compliant with RFC 2616 or if the <a href="Time.html"><code>Time</code></a> class cannot represent specified date.</p>

<p>See <a href="Time.html#method-i-httpdate"><code>httpdate</code></a> for more information on this format.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-constant">Time</span>.<span class="ruby-identifier">httpdate</span>(<span class="ruby-string">&quot;Thu, 06 Oct 2011 02:26:12 GMT&quot;</span>)
<span class="ruby-comment">#=&gt; 2011-10-06 02:26:12 UTC</span>
</pre>

<p>You must require ‘time’ to use this method.</p>

                              <div class="method-source-code" id="httpdate-source">
            <pre><span class="ruby-comment"># File time.rb, line 566</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">httpdate</span>(<span class="ruby-identifier">date</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">date</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/\A\s*
      (?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\x20
      (\d{2})\x20
      (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\x20
      (\d{4})\x20
      (\d{2}):(\d{2}):(\d{2})\x20
      GMT
      \s*\z/ix</span>)
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">rfc2822</span>(<span class="ruby-identifier">date</span>).<span class="ruby-identifier">utc</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-regexp">/\A\s*
         (?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday),\x20
         (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d)\x20
         (\d\d):(\d\d):(\d\d)\x20
         GMT
         \s*\z/ix</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">date</span>
    <span class="ruby-identifier">year</span> = <span class="ruby-node">$3</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">50</span>
      <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">2000</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1900</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-identifier">year</span>, <span class="ruby-node">$2</span>, <span class="ruby-node">$1</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-node">$4</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-node">$5</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-node">$6</span>.<span class="ruby-identifier">to_i</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-regexp">/\A\s*
         (?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\x20
         (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\x20
         (\d\d|\x20\d)\x20
         (\d\d):(\d\d):(\d\d)\x20
         (\d{4})
         \s*\z/ix</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">date</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-node">$6</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-constant">MonthValue</span>[<span class="ruby-node">$1</span>.<span class="ruby-identifier">upcase</span>], <span class="ruby-node">$2</span>.<span class="ruby-identifier">to_i</span>,
             <span class="ruby-node">$3</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-node">$4</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-node">$5</span>.<span class="ruby-identifier">to_i</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;not RFC 2616 compliant date: #{date.inspect}&quot;</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-iso8601" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">iso8601</span><span
                                class="method-args">(time)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-c-xmlschema">xmlschema</a>
                            </div>
                          </div>

                  <div id="method-c-parse" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse</span><span
                                class="method-args">(date, now=self.now) { |year| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Takes a string representation of a <a href="Time.html"><code>Time</code></a> and attempts to parse it using a heuristic.</p>

<p>This method **does not** function as a validator.  If the input string does not match valid formats strictly, you may get a cryptic result.  Should consider to use ‘Time.strptime` instead of this method as possible.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;2010-10-31&quot;</span>) <span class="ruby-comment">#=&gt; 2010-10-31 00:00:00 -0500</span>
</pre>

<p>Any missing pieces of the date are inferred based on the current date.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-comment"># assuming the current date is &quot;2011-10-31&quot;</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;12:00&quot;</span>) <span class="ruby-comment">#=&gt; 2011-10-31 12:00:00 -0500</span>
</pre>

<p>We can change the date used to infer our missing elements by passing a second object that responds to mon, day and year, such as Date, <a href="Time.html"><code>Time</code></a> or DateTime. We can also use our own object.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-keyword">class</span> <span class="ruby-constant">MyDate</span>
  <span class="ruby-identifier">attr_reader</span> <span class="ruby-value">:mon</span>, <span class="ruby-value">:day</span>, <span class="ruby-value">:year</span>

  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">mon</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">year</span>)
    <span class="ruby-ivar">@mon</span>, <span class="ruby-ivar">@day</span>, <span class="ruby-ivar">@year</span> = <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">year</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>

<span class="ruby-identifier">d</span>  = <span class="ruby-constant">Date</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;2010-10-28&quot;</span>)
<span class="ruby-identifier">t</span>  = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;2010-10-29&quot;</span>)
<span class="ruby-identifier">dt</span> = <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;2010-10-30&quot;</span>)
<span class="ruby-identifier">md</span> = <span class="ruby-constant">MyDate</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">10</span>,<span class="ruby-value">31</span>,<span class="ruby-value">2010</span>)

<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;12:00&quot;</span>, <span class="ruby-identifier">d</span>)  <span class="ruby-comment">#=&gt; 2010-10-28 12:00:00 -0500</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;12:00&quot;</span>, <span class="ruby-identifier">t</span>)  <span class="ruby-comment">#=&gt; 2010-10-29 12:00:00 -0500</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;12:00&quot;</span>, <span class="ruby-identifier">dt</span>) <span class="ruby-comment">#=&gt; 2010-10-30 12:00:00 -0500</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;12:00&quot;</span>, <span class="ruby-identifier">md</span>) <span class="ruby-comment">#=&gt; 2010-10-31 12:00:00 -0500</span>
</pre>

<p>If a block is given, the year described in <code>date</code> is converted by the block.  This is specifically designed for handling two digit years. For example, if you wanted to treat all two digit years prior to 70 as the year 2000+ you could write this:</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;01-10-31&quot;</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">year</span><span class="ruby-operator">|</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">year</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">70</span> <span class="ruby-operator">?</span> <span class="ruby-value">2000</span> <span class="ruby-operator">:</span> <span class="ruby-value">1900</span>)}
<span class="ruby-comment">#=&gt; 2001-10-31 00:00:00 -0500</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;70-10-31&quot;</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">year</span><span class="ruby-operator">|</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">year</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">70</span> <span class="ruby-operator">?</span> <span class="ruby-value">2000</span> <span class="ruby-operator">:</span> <span class="ruby-value">1900</span>)}
<span class="ruby-comment">#=&gt; 1970-10-31 00:00:00 -0500</span>
</pre>

<p>If the upper components of the given time are broken or missing, they are supplied with those of <code>now</code>.  For the lower components, the minimum values (1 or 0) are assumed if broken or missing.  For example:</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-comment"># Suppose it is &quot;Thu Nov 29 14:33:20 2001&quot; now and</span>
<span class="ruby-comment"># your time zone is EST which is GMT-5.</span>
<span class="ruby-identifier">now</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;Thu Nov 29 14:33:20 2001&quot;</span>)
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;16:30&quot;</span>, <span class="ruby-identifier">now</span>)     <span class="ruby-comment">#=&gt; 2001-11-29 16:30:00 -0500</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;7/23&quot;</span>, <span class="ruby-identifier">now</span>)      <span class="ruby-comment">#=&gt; 2001-07-23 00:00:00 -0500</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;Aug 31&quot;</span>, <span class="ruby-identifier">now</span>)    <span class="ruby-comment">#=&gt; 2001-08-31 00:00:00 -0500</span>
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;Aug 2000&quot;</span>, <span class="ruby-identifier">now</span>)  <span class="ruby-comment">#=&gt; 2000-08-01 00:00:00 -0500</span>
</pre>

<p>Since there are numerous conflicts among locally defined time zone abbreviations all over the world, this method is not intended to understand all of them.  For example, the abbreviation “CST” is used variously as:</p>

<pre>-06:00 in America/Chicago,
-05:00 in America/Havana,
+08:00 in Asia/Harbin,
+09:30 in Australia/Darwin,
+10:30 in Australia/Adelaide,
etc.</pre>

<p>Based on this fact, this method only understands the time zone abbreviations described in RFC 822 and the system time zone, in the order named. (i.e. a definition in RFC 822 overrides the system time zone definition.)  The system time zone is taken from <code>Time.local(year, 1, 1).zone</code> and <code>Time.local(year, 7, 1).zone</code>. If the extracted time zone abbreviation does not match any of them, it is ignored and the given time is regarded as a local time.</p>

<p>ArgumentError is raised if Date._parse cannot extract information from <code>date</code> or if the <a href="Time.html"><code>Time</code></a> class cannot represent specified date.</p>

<p>This method can be used as a fail-safe for other parsing methods as:</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">rfc2822</span>(<span class="ruby-identifier">date</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">date</span>)
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">httpdate</span>(<span class="ruby-identifier">date</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">date</span>)
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">xmlschema</span>(<span class="ruby-identifier">date</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">date</span>)
</pre>

<p>A failure of <a href="Time.html#method-c-parse"><code>Time.parse</code></a> should be checked, though.</p>

<p>You must require ‘time’ to use this method.</p>

                              <div class="method-source-code" id="parse-source">
            <pre><span class="ruby-comment"># File time.rb, line 381</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">now</span>=<span class="ruby-keyword">self</span>.<span class="ruby-identifier">now</span>)
  <span class="ruby-identifier">comp</span> = <span class="ruby-operator">!</span><span class="ruby-identifier">block_given?</span>
  <span class="ruby-identifier">d</span> = <span class="ruby-constant">Date</span>.<span class="ruby-identifier">_parse</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">comp</span>)
  <span class="ruby-identifier">year</span> = <span class="ruby-identifier">d</span>[<span class="ruby-value">:year</span>]
  <span class="ruby-identifier">year</span> = <span class="ruby-keyword">yield</span>(<span class="ruby-identifier">year</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">comp</span>
  <span class="ruby-identifier">make_time</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">year</span>, <span class="ruby-identifier">d</span>[<span class="ruby-value">:yday</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:mon</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:mday</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:hour</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:min</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:sec</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:sec_fraction</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:zone</span>], <span class="ruby-identifier">now</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-rfc2822" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">rfc2822</span><span
                                class="method-args">(date)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Parses <code>date</code> as date-time defined by RFC 2822 and converts it to a <a href="Time.html"><code>Time</code></a> object.  The format is identical to the date format defined by RFC 822 and updated by RFC 1123.</p>

<p>ArgumentError is raised if <code>date</code> is not compliant with RFC 2822 or if the <a href="Time.html"><code>Time</code></a> class cannot represent specified date.</p>

<p>See <a href="Time.html#method-i-rfc2822"><code>rfc2822</code></a> for more information on this format.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-constant">Time</span>.<span class="ruby-identifier">rfc2822</span>(<span class="ruby-string">&quot;Wed, 05 Oct 2011 22:26:12 -0400&quot;</span>)
<span class="ruby-comment">#=&gt; 2010-10-05 22:26:12 -0400</span>
</pre>

<p>You must require ‘time’ to use this method.</p>

                              <div class="method-source-code" id="rfc2822-source">
            <pre><span class="ruby-comment"># File time.rb, line 508</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">rfc2822</span>(<span class="ruby-identifier">date</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-regexp">/\A\s*
      (?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s*,\s*)?
      (\d{1,2})\s+
      (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+
      (\d{2,})\s+
      (\d{2})\s*
      :\s*(\d{2})
      (?:\s*:\s*(\d\d))?\s+
      ([+-]\d{4}|
       UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|[A-IK-Z])/ix</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">date</span>
    <span class="ruby-comment"># Since RFC 2822 permit comments, the regexp has no right anchor.</span>
    <span class="ruby-identifier">day</span> = <span class="ruby-node">$1</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-identifier">mon</span> = <span class="ruby-constant">MonthValue</span>[<span class="ruby-node">$2</span>.<span class="ruby-identifier">upcase</span>]
    <span class="ruby-identifier">year</span> = <span class="ruby-node">$3</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-identifier">short_year_p</span> = <span class="ruby-node">$3</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">3</span>
    <span class="ruby-identifier">hour</span> = <span class="ruby-node">$4</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-identifier">min</span> = <span class="ruby-node">$5</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-identifier">sec</span> = <span class="ruby-node">$6</span> <span class="ruby-operator">?</span> <span class="ruby-node">$6</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">zone</span> = <span class="ruby-node">$7</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">short_year_p</span>
      <span class="ruby-comment"># following year completion is compliant with RFC 2822.</span>
      <span class="ruby-identifier">year</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">50</span>
               <span class="ruby-value">2000</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">year</span>
             <span class="ruby-keyword">else</span>
               <span class="ruby-value">1900</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">year</span>
             <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">off</span> = <span class="ruby-identifier">zone_offset</span>(<span class="ruby-identifier">zone</span>)
    <span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span> =
      <span class="ruby-identifier">apply_offset</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">off</span>)
    <span class="ruby-identifier">t</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>)
    <span class="ruby-identifier">force_zone!</span>(<span class="ruby-identifier">t</span>, <span class="ruby-identifier">zone</span>, <span class="ruby-identifier">off</span>)
    <span class="ruby-identifier">t</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;not RFC 2822 compliant date: #{date.inspect}&quot;</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-c-rfc822">rfc822</a>
                            </div>

                          </div>

                  <div id="method-c-rfc822" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">rfc822</span><span
                                class="method-args">(date)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-c-rfc2822">rfc2822</a>
                            </div>
                          </div>

                  <div id="method-c-strptime" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">strptime</span><span
                                class="method-args">(date, format, now=self.now) { |year| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Works similar to <code>parse</code> except that instead of using a heuristic to detect the format of the input string, you provide a second argument that describes the format of the string.</p>

<p>If a block is given, the year described in <code>date</code> is converted by the block.  For example:</p>

<pre>Time.strptime(...) {|y| y &lt; 100 ? (y &gt;= 69 ? y + 1900 : y + 2000) : y}</pre>

<p>Below is a list of the formatting options:</p>
<dl class="rdoc-list note-list"><dt>%a 
<dd>
<p>The abbreviated weekday name (“Sun”)</p>
</dd><dt>%A 
<dd>
<p>The  full  weekday  name (“Sunday”)</p>
</dd><dt>%b 
<dd>
<p>The abbreviated month name (“Jan”)</p>
</dd><dt>%B 
<dd>
<p>The  full  month  name (“January”)</p>
</dd><dt>%c 
<dd>
<p>The preferred local date and time representation</p>
</dd><dt>%C 
<dd>
<p>Century (20 in 2009)</p>
</dd><dt>%d 
<dd>
<p>Day of the month (01..31)</p>
</dd><dt>%D 
<dd>
<p>Date (%m/%d/%y)</p>
</dd><dt>%e 
<dd>
<p>Day of the month, blank-padded ( 1..31)</p>
</dd><dt>%F 
<dd>
<p>Equivalent to %Y-%m-%d (the ISO 8601 date format)</p>
</dd><dt>%g 
<dd>
<p>The last two digits of the commercial year</p>
</dd><dt>%G 
<dd>
<p>The week-based year according to ISO-8601 (week 1 starts on Monday and includes January 4)</p>
</dd><dt>%h 
<dd>
<p>Equivalent to %b</p>
</dd><dt>%H 
<dd>
<p>Hour of the day, 24-hour clock (00..23)</p>
</dd><dt>%I 
<dd>
<p>Hour of the day, 12-hour clock (01..12)</p>
</dd><dt>%j 
<dd>
<p>Day of the year (001..366)</p>
</dd><dt>%k 
<dd>
<p>hour, 24-hour clock, blank-padded ( 0..23)</p>
</dd><dt>%l 
<dd>
<p>hour, 12-hour clock, blank-padded ( 0..12)</p>
</dd><dt>%L 
<dd>
<p>Millisecond of the second (000..999)</p>
</dd><dt>%m 
<dd>
<p>Month of the year (01..12)</p>
</dd><dt>%M 
<dd>
<p>Minute of the hour (00..59)</p>
</dd><dt>%n 
<dd>
<p>Newline (n)</p>
</dd><dt>%N 
<dd>
<p>Fractional seconds digits</p>
</dd><dt>%p 
<dd>
<p>Meridian indicator (“AM” or “PM”)</p>
</dd><dt>%P 
<dd>
<p>Meridian indicator (“am” or “pm”)</p>
</dd><dt>%r 
<dd>
<p>time, 12-hour (same as %I:%M:%S %p)</p>
</dd><dt>%R 
<dd>
<p>time, 24-hour (%H:%M)</p>
</dd><dt>%s 
<dd>
<p>Number of seconds since 1970-01-01 00:00:00 UTC.</p>
</dd><dt>%S 
<dd>
<p>Second of the minute (00..60)</p>
</dd><dt>%t 
<dd>
<p>Tab character (t)</p>
</dd><dt>%T 
<dd>
<p>time, 24-hour (%H:%M:%S)</p>
</dd><dt>%u 
<dd>
<p>Day of the week as a decimal, Monday being 1. (1..7)</p>
</dd><dt>%U 
<dd>
<p>Week number of the current year, starting with the first Sunday as the first day of the first week (00..53)</p>
</dd><dt>%v 
<dd>
<p>VMS date (%e-%b-%Y)</p>
</dd><dt>%V 
<dd>
<p>Week number of year according to ISO 8601 (01..53)</p>
</dd><dt>%W 
<dd>
<p>Week  number  of the current year, starting with the first Monday as the first day of the first week (00..53)</p>
</dd><dt>%w 
<dd>
<p>Day of the week (Sunday is 0, 0..6)</p>
</dd><dt>%x 
<dd>
<p>Preferred representation for the date alone, no time</p>
</dd><dt>%X 
<dd>
<p>Preferred representation for the time alone, no date</p>
</dd><dt>%y 
<dd>
<p>Year without a century (00..99)</p>
</dd><dt>%Y 
<dd>
<p>Year which may include century, if provided</p>
</dd><dt>%z 
<dd>
<p><a href="Time.html"><code>Time</code></a> zone as  hour offset from UTC (e.g. +0900)</p>
</dd><dt>%Z 
<dd>
<p><a href="Time.html"><code>Time</code></a> zone name</p>
</dd><dt>%% 
<dd>
<p>Literal “%” character</p>
</dd><dt>%+ 
<dd>
<p>date(1) (%a %b %e %H:%M:%S %Z %Y)</p>
</dd></dl>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-constant">Time</span>.<span class="ruby-identifier">strptime</span>(<span class="ruby-string">&quot;2000-10-31&quot;</span>, <span class="ruby-string">&quot;%Y-%m-%d&quot;</span>) <span class="ruby-comment">#=&gt; 2000-10-31 00:00:00 -0500</span>
</pre>

<p>You must require ‘time’ to use this method.</p>

                              <div class="method-source-code" id="strptime-source">
            <pre><span class="ruby-comment"># File time.rb, line 456</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">strptime</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">format</span>, <span class="ruby-identifier">now</span>=<span class="ruby-keyword">self</span>.<span class="ruby-identifier">now</span>)
  <span class="ruby-identifier">d</span> = <span class="ruby-constant">Date</span>.<span class="ruby-identifier">_strptime</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">format</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;invalid date or strptime format - `#{date}&#39; `#{format}&#39;&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">d</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">seconds</span> = <span class="ruby-identifier">d</span>[<span class="ruby-value">:seconds</span>]
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">sec_fraction</span> = <span class="ruby-identifier">d</span>[<span class="ruby-value">:sec_fraction</span>]
      <span class="ruby-identifier">usec</span> = <span class="ruby-identifier">sec_fraction</span> <span class="ruby-operator">*</span> <span class="ruby-value">1000000</span>
      <span class="ruby-identifier">usec</span> <span class="ruby-operator">*=</span> <span class="ruby-value">-1</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">seconds</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">usec</span> = <span class="ruby-value">0</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">seconds</span>, <span class="ruby-identifier">usec</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">zone</span> = <span class="ruby-identifier">d</span>[<span class="ruby-value">:zone</span>]
      <span class="ruby-identifier">force_zone!</span>(<span class="ruby-identifier">t</span>, <span class="ruby-identifier">zone</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">year</span> = <span class="ruby-identifier">d</span>[<span class="ruby-value">:year</span>]
    <span class="ruby-identifier">year</span> = <span class="ruby-keyword">yield</span>(<span class="ruby-identifier">year</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-identifier">yday</span> = <span class="ruby-identifier">d</span>[<span class="ruby-value">:yday</span>]
    <span class="ruby-keyword">if</span> (<span class="ruby-identifier">d</span>[<span class="ruby-value">:cwyear</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">year</span>) <span class="ruby-operator">||</span> ((<span class="ruby-identifier">d</span>[<span class="ruby-value">:cwday</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">d</span>[<span class="ruby-value">:cweek</span>]) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span>(<span class="ruby-identifier">d</span>[<span class="ruby-value">:mon</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">d</span>[<span class="ruby-value">:mday</span>]))
      <span class="ruby-comment"># make_time doesn&#39;t deal with cwyear/cwday/cweek</span>
      <span class="ruby-keyword">return</span> <span class="ruby-constant">Date</span>.<span class="ruby-identifier">strptime</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">format</span>).<span class="ruby-identifier">to_time</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">if</span> (<span class="ruby-identifier">d</span>[<span class="ruby-value">:wnum0</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">d</span>[<span class="ruby-value">:wnum1</span>]) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">yday</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span>(<span class="ruby-identifier">d</span>[<span class="ruby-value">:mon</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">d</span>[<span class="ruby-value">:mday</span>])
      <span class="ruby-identifier">yday</span> = <span class="ruby-constant">Date</span>.<span class="ruby-identifier">strptime</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">format</span>).<span class="ruby-identifier">yday</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">t</span> = <span class="ruby-identifier">make_time</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">year</span>, <span class="ruby-identifier">yday</span>, <span class="ruby-identifier">d</span>[<span class="ruby-value">:mon</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:mday</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:hour</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:min</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:sec</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:sec_fraction</span>], <span class="ruby-identifier">d</span>[<span class="ruby-value">:zone</span>], <span class="ruby-identifier">now</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">t</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-xmlschema" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">xmlschema</span><span
                                class="method-args">(time)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Parses <code>time</code> as a dateTime defined by the XML Schema and converts it to a <a href="Time.html"><code>Time</code></a> object.  The format is a restricted version of the format defined by ISO 8601.</p>

<p>ArgumentError is raised if <code>time</code> is not compliant with the format or if the <a href="Time.html"><code>Time</code></a> class cannot represent the specified time.</p>

<p>See <a href="Time.html#method-i-xmlschema"><code>xmlschema</code></a> for more information on this format.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-constant">Time</span>.<span class="ruby-identifier">xmlschema</span>(<span class="ruby-string">&quot;2011-10-05T22:26:12-04:00&quot;</span>)
<span class="ruby-comment">#=&gt; 2011-10-05 22:26:12-04:00</span>
</pre>

<p>You must require ‘time’ to use this method.</p>

                              <div class="method-source-code" id="xmlschema-source">
            <pre><span class="ruby-comment"># File time.rb, line 620</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">xmlschema</span>(<span class="ruby-identifier">time</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-regexp">/\A\s*
      (-?\d+)-(\d\d)-(\d\d)
      T
      (\d\d):(\d\d):(\d\d)
      (\.\d+)?
      (Z|[+-]\d\d(?::?\d\d)?)?
      \s*\z/ix</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">time</span>
    <span class="ruby-identifier">year</span> = <span class="ruby-node">$1</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-identifier">mon</span> = <span class="ruby-node">$2</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-identifier">day</span> = <span class="ruby-node">$3</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-identifier">hour</span> = <span class="ruby-node">$4</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-identifier">min</span> = <span class="ruby-node">$5</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-identifier">sec</span> = <span class="ruby-node">$6</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-identifier">usec</span> = <span class="ruby-value">0</span>
    <span class="ruby-keyword">if</span> <span class="ruby-node">$7</span>
      <span class="ruby-identifier">usec</span> = <span class="ruby-constant">Rational</span>(<span class="ruby-node">$7</span>) <span class="ruby-operator">*</span> <span class="ruby-value">1000000</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">if</span> <span class="ruby-node">$8</span>
      <span class="ruby-identifier">zone</span> = <span class="ruby-node">$8</span>
      <span class="ruby-identifier">off</span> = <span class="ruby-identifier">zone_offset</span>(<span class="ruby-identifier">zone</span>)
      <span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span> =
        <span class="ruby-identifier">apply_offset</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">off</span>)
      <span class="ruby-identifier">t</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">usec</span>)
      <span class="ruby-identifier">force_zone!</span>(<span class="ruby-identifier">t</span>, <span class="ruby-identifier">zone</span>, <span class="ruby-identifier">off</span>)
      <span class="ruby-identifier">t</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-keyword">self</span>.<span class="ruby-identifier">local</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">usec</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;invalid xmlschema format: #{time.inspect}&quot;</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-c-iso8601">iso8601</a>
                            </div>

                          </div>

                  <div id="method-c-zone_offset" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">zone_offset</span><span
                                class="method-args">(zone, year=self.now.year)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Return the number of seconds the specified time zone differs from UTC.</p>

<p>Numeric time zones that include minutes, such as <code>-10:00</code> or <code>+1330</code> will work, as will simpler hour-only time zones like <code>-10</code> or <code>+13</code>.</p>

<p>Textual time zones listed in ZoneOffset are also supported.</p>

<p>If the time zone does not match any of the above, <code>zone_offset</code> will check if the local time zone (both with and without potential Daylight Saving Time changes being in effect) matches <code>zone</code>. Specifying a value for <code>year</code> will change the year used to find the local time zone.</p>

<p>If <code>zone_offset</code> is unable to determine the offset, nil will be returned.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone_offset</span>(<span class="ruby-string">&quot;EST&quot;</span>) <span class="ruby-comment">#=&gt; -18000</span>
</pre>

<p>You must require ‘time’ to use this method.</p>

                              <div class="method-source-code" id="zone_offset-source">
            <pre><span class="ruby-comment"># File time.rb, line 82</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">zone_offset</span>(<span class="ruby-identifier">zone</span>, <span class="ruby-identifier">year</span>=<span class="ruby-keyword">self</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">year</span>)
  <span class="ruby-identifier">off</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">zone</span> = <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">upcase</span>
  <span class="ruby-keyword">if</span> <span class="ruby-regexp">/\A([+-])(\d\d)(:?)(\d\d)(?:\3(\d\d))?\z/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">zone</span>
    <span class="ruby-identifier">off</span> = (<span class="ruby-node">$1</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;-&#39;</span> <span class="ruby-operator">?</span> <span class="ruby-value">-1</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span>) <span class="ruby-operator">*</span> ((<span class="ruby-node">$2</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">+</span> <span class="ruby-node">$4</span>.<span class="ruby-identifier">to_i</span>) <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">+</span> <span class="ruby-node">$5</span>.<span class="ruby-identifier">to_i</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/\A[+-]\d\d\z/</span>)
    <span class="ruby-identifier">off</span> = <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">*</span> <span class="ruby-value">3600</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-constant">ZoneOffset</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">zone</span>)
    <span class="ruby-identifier">off</span> = <span class="ruby-constant">ZoneOffset</span>[<span class="ruby-identifier">zone</span>] <span class="ruby-operator">*</span> <span class="ruby-value">3600</span>
  <span class="ruby-keyword">elsif</span> ((<span class="ruby-identifier">t</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">local</span>(<span class="ruby-identifier">year</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>)).<span class="ruby-identifier">zone</span>.<span class="ruby-identifier">upcase</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">zone</span> <span class="ruby-keyword">rescue</span> <span class="ruby-keyword">false</span>)
    <span class="ruby-identifier">off</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">utc_offset</span>
  <span class="ruby-keyword">elsif</span> ((<span class="ruby-identifier">t</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">local</span>(<span class="ruby-identifier">year</span>, <span class="ruby-value">7</span>, <span class="ruby-value">1</span>)).<span class="ruby-identifier">zone</span>.<span class="ruby-identifier">upcase</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">zone</span> <span class="ruby-keyword">rescue</span> <span class="ruby-keyword">false</span>)
    <span class="ruby-identifier">off</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">utc_offset</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">off</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-httpdate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">httpdate</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a string which represents the time as RFC 1123 date of HTTP-date defined by RFC 2616:</p>

<pre>day-of-week, DD month-name CCYY hh:mm:ss GMT</pre>

<p>Note that the result is always UTC (GMT).</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">httpdate</span> <span class="ruby-comment"># =&gt; &quot;Thu, 06 Oct 2011 02:26:12 GMT&quot;</span>
</pre>

<p>You must require ‘time’ to use this method.</p>

                              <div class="method-source-code" id="httpdate-source">
            <pre><span class="ruby-comment"># File time.rb, line 692</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">httpdate</span>
  <span class="ruby-identifier">getutc</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-string">&#39;%a, %d %b %Y %T GMT&#39;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-iso8601" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">iso8601</span><span
                                class="method-args">(fraction_digits=0)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-xmlschema">xmlschema</a>
                            </div>
                          </div>

                  <div id="method-i-rfc2822" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">rfc2822</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a string which represents the time as date-time defined by RFC 2822:</p>

<pre>day-of-week, DD month-name CCYY hh:mm:ss zone</pre>

<p>where zone is [+-]hhmm.</p>

<p>If <code>self</code> is a UTC time, -0000 is used as zone.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">rfc2822</span>  <span class="ruby-comment"># =&gt; &quot;Wed, 05 Oct 2011 22:26:12 -0400&quot;</span>
</pre>

<p>You must require ‘time’ to use this method.</p>

                              <div class="method-source-code" id="rfc2822-source">
            <pre><span class="ruby-comment"># File time.rb, line 672</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">rfc2822</span>
  <span class="ruby-identifier">strftime</span>(<span class="ruby-string">&#39;%a, %d %b %Y %T &#39;</span>) <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">utc?</span> <span class="ruby-operator">?</span> <span class="ruby-string">&#39;-0000&#39;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">strftime</span>(<span class="ruby-string">&#39;%z&#39;</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-rfc822">rfc822</a>
                            </div>

                          </div>

                  <div id="method-i-rfc822" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">rfc822</span><span
                                class="method-args">()</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Time.html#method-i-rfc2822">rfc2822</a>
                            </div>
                          </div>

                  <div id="method-i-xmlschema" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">xmlschema</span><span
                                class="method-args">(fraction_digits=0)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a string which represents the time as a dateTime defined by XML Schema:</p>

<pre>CCYY-MM-DDThh:mm:ssTZD
CCYY-MM-DDThh:mm:ss.sssTZD</pre>

<p>where TZD is Z or [+-]hh:mm.</p>

<p>If self is a UTC time, Z is used as TZD.  [+-]hh:mm is used otherwise.</p>

<p><code>fraction_digits</code> specifies a number of digits to use for fractional seconds.  Its default value is 0.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;time&#39;</span>

<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">iso8601</span>  <span class="ruby-comment"># =&gt; &quot;2011-10-05T22:26:12-04:00&quot;</span>
</pre>

<p>You must require ‘time’ to use this method.</p>

                              <div class="method-source-code" id="xmlschema-source">
            <pre><span class="ruby-comment"># File time.rb, line 717</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">xmlschema</span>(<span class="ruby-identifier">fraction_digits</span>=<span class="ruby-value">0</span>)
  <span class="ruby-identifier">fraction_digits</span> = <span class="ruby-identifier">fraction_digits</span>.<span class="ruby-identifier">to_i</span>
  <span class="ruby-identifier">s</span> = <span class="ruby-identifier">strftime</span>(<span class="ruby-string">&quot;%FT%T&quot;</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">fraction_digits</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">strftime</span>(<span class="ruby-node">&quot;.%#{fraction_digits}N&quot;</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">utc?</span> <span class="ruby-operator">?</span> <span class="ruby-string">&#39;Z&#39;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">strftime</span>(<span class="ruby-string">&quot;%:z&quot;</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Time.html#method-i-iso8601">iso8601</a>
                            </div>

                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

